unit UnMeuThread;

interface

uses
 Classes;

type
 TProc = procedure of object;

type
 TMeuThread = class(TThread)
 private
  { Private declarations }
 protected
  procedure Execute; override;
 public
  FProc: TProc;
  constructor Create(Proc: TProc);
 end;



implementation

{ Important: Methods and properties of objects in visual components can only be
  used in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure TMeuThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ TMeuThread }

constructor TMeuThread.Create(Proc: TProc);
begin
 inherited Create(True);
 FProc := Proc;
 FreeOnTerminate := True;
 // Priority := tpHighest;
 Resume;
end;

procedure TMeuThread.Execute;
begin
FProc;
// Synchronize(FProc);
end;

end.

